const wxdata = {
  // 产品浏览上报
  browse: (product) => {
    wx.reportEvent('wxdata_browse_goods', {
      "spu_id": product.id,
      "spu_name": product.name,
      "sku_id": product.id,
      "sku_name": product.name,
      "price_original": product.price,
      "price_current": product.price
    })
  },

  // 产品曝光上报
  expose: (product) => {
    wx.reportEvent("wxdata_expose_goods", {
      "spu_id": product.id,
      "spu_name": product.name,
      "sku_id": product.id,
      "sku_name": product.name,
      "price_original": product.price,
      "price_current": product.price,
    })
  },

  // 分享上报
  share: (product) => {
    wx.reportEvent("wxdata_page_share", {
      "spu_id": product.id,
      "spu_name": product.name,
      "share_image_url": "https://static.fishto.cn/images/share-thumb.png",
      "share_title": product.name,
      "share_to": 1,
      "share_from": 1,
      "is_goods_page": 1,
    })
  },

  // 订单页上报
  purchase: (product) => {
    wx.reportEvent("wxdata_purchase_goods", {
      "spu_id": product.id,
      "spu_name": product.name,
      "sku_id": product.id,
      "sku_name": product.name,
      "price_original": product.price,
      "price_current": product.price,
      "action_type": 0,
      "action_num": 1,
      "is_goods_page": 0,
    })
  },

  // 调用支付上报
  requestPay: (product, order) => {
    wx.reportEvent("wxdata_order_status", {
      "spu_id": product.id,
      "spu_name": product.name,
      "sku_id": product.id,
      "sku_name": product.name,
      "price_original": order.amount,
      "price_current": order.amount,
      "sku_count": 1,
      "sku_pay_amt": 1,
      "order_amt": order.amount,
      "pay_amt": order.amount,
      "order_id": order.id,
      "order_status": 3,
    })
  },

  // 支付成功上报
  completePay: (product, order) => {
    wx.reportEvent("wxdata_order_status", {
      "spu_id": product.id,
      "spu_name": product.name,
      "sku_id": product.id,
      "sku_name": product.name,
      "price_original": order.amount,
      "price_current": order.amount,
      "sku_count": 1,
      "sku_pay_amt": 1,
      "order_amt": order.amount,
      "pay_amt": order.amount,
      "order_id": order.id,
      "order_status": 11,
    })
  },


};

module.exports = wxdata;